<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
  <div id="target1"></div>
</div>
<script>
    description("Test pointerLockElement is null when a lock is pending.")
    window.jsTestIsAsync = true;

    targetDiv1 = document.getElementById("target1");

    todo = [
        function () {
            shouldBe("document.pointerLockElement", "null");
            testRunner.setPointerLockWillRespondAsynchronously();
            expectOnlyChangeEvent("Lock.");
            targetDiv1.requestPointerLock();
            doNextStep();
        },
        function () {
            shouldBe("document.pointerLockElement", "null");
            testRunner.allowPointerLock();
            // doNextStep called from event handler set with expect...
        },
        function () {
            shouldBe("document.pointerLockElement", "targetDiv1");
            expectOnlyChangeEvent("Unlock.");
            document.exitPointerLock();
            // doNextStep called from event handler set with expect...
        },
        function () {
            shouldBe("document.pointerLockElement", "null");
            doNextStep();
        },
    ];
    doNextStepWithUserGesture();
</script>
</body>
</html>
